
import com.liu.lab10.controller.UserController;
import com.liu.lab10.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLOutput;

public class test {


//    测试注解方式
    @Test
    public void testzhujie(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-annotation.xml");
        UserController userController = (UserController) context.getBean("userController");
        System.out.println(userController.login("刘小文","123456"));

        userController.info(242071010,"刘小文");
    }


//    测试 P 命名 和 C 命名空间方式
    @Test
    public void Text_P_C(){
        ApplicationContext app = new ClassPathXmlApplicationContext("bean-ns.xml");
        User user = (User) app.getBean("user");
        System.out.println(
                user.toString()
        );
    }
    public static void main(String[] args) {
//        获取配置文件
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
//        获取bean
        User user = (User) app.getBean("user");
        System.out.println(user.toString());

    }


}
